import os
import signal
import sys
def kill(pid):
    import signal
    pname=os.popen('ps -ef| grep %s | grep -v grep' % pid)
    print "kill pid:[%s]" % pname.readlines()
    try:
        ret=os.kill(int(pid),signal.SIGKILL)
        print ret
        print "killed pid=[%s],ret=[%s]" % (pid ,str(ret))
        return ret
    except Exception as e:
        print 'error:[%s]' % repr(e)
        return 1
if __name__ == '__main__':
   with open('./cronMain.pid','r') as f:
        pid = f.readline()
        if not pid:
           print 'pid is null'
           sys.exit(1)
        else:
           print kill(pid) 
'''
   with open('./kill.txt','r') as f:
        while True:
              pidlist = f.readline()
              if not pidlist:
                 break
              else:
                pid= pidlist.split(' ')[0]
                print kill(pid)
'''
